package hopital.ui;


import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;

public class ComboBox<T> extends JComboBox<T> {

    private static final long serialVersionUID = 1L;
    private final DefaultComboBoxModel<T> _model;

    public ComboBox() {
        _model = new DefaultComboBoxModel<>();
        this.setModel(_model);
    }



    @Override
    public void addItem(T arg0) {
        _model.addElement(arg0);
    }

    @Override
    public void removeItem(Object arg0) {
        _model.removeElement(arg0);
    }

    public void addItems( T... args) {
        for (T o : args) {
            addItem(o);
        }
    }

    public void removeItems( T... args) {
        for (T o : args) {
            removeItem(o);
        }
    }

    @Override
    public void removeAllItems() {
        _model.removeAllElements();
    }

}
